﻿<UserControl x:Class="DeltaGroup.WheelOfJeopardy.UI.Screens.ChallengePrompt"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Commands="clr-namespace:DeltaGroup.WheelOfJeopardy.UI.Commands" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="500" Height="500" Margin="0,20"
             >
    <UserControl.CommandBindings>
        <CommandBinding Command="Commands:WoJCommands.RespondChallenge" CanExecute="CanRespond" Executed="Responded" ></CommandBinding>
    </UserControl.CommandBindings>
    <StackPanel Name="MainBody">
        <TextBlock Text="{Binding Path=Challenge.Category}" TextWrapping="Wrap" Style="{StaticResource Title}"/>
        <TextBlock Text="Time Remaining" Style="{StaticResource Title}"/>
        <TextBlock x:Name="ChallengeTime" Text="{Binding Path=TimeRemaining}" Style="{StaticResource Title}"/>
        <Grid Name="ResponseSection">
            <Grid.Resources>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="Margin" Value="5" />
                </Style>
                <Style TargetType="{x:Type TextBox}">
                    <Setter Property="Margin" Value="5" />
                </Style>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="3*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Text="Answer:" Grid.Row="0" Grid.Column="0" />
            <TextBlock Text="{Binding Path=Challenge.Prompt}" VerticalAlignment="Top" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1"   />

            <TextBlock Text="Question:" Grid.Row="1" Grid.Column="0" />
            <TextBox x:Name="ChallengeResponse" Grid.Row="1" Grid.Column="1" SpellCheck.IsEnabled="True" >
                <TextBox.Text>
                    <Binding Path="Response" UpdateSourceTrigger="PropertyChanged" ValidatesOnDataErrors="True" NotifyOnValidationError="True">
                    </Binding>
                </TextBox.Text>
            </TextBox>

            <Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Content=">>> Show Result >>>"  Command="Commands:WoJCommands.RespondChallenge" Style="{StaticResource GameMenu}"/>
        </Grid>
        <StackPanel Name="TimeExpiredSection" Visibility="Hidden" HorizontalAlignment="Center">
            <TextBlock Text="Ooops you did not respond in time ... " Style="{StaticResource Title}" />
            <Button Click="TimerExpire" Margin="0,10" Style="{StaticResource GameMenu}">
                <Button.Content>
                    <TextBlock Text="Continue"></TextBlock>
                </Button.Content>
            </Button>
        </StackPanel>
    </StackPanel>

</UserControl>
